package web.action.com;


import com.fz.us.base.bean.BaseEnum;
import com.fz.us.base.bean.BaseEnum.StateEnum;
import com.fz.us.base.bean.Pager;
import com.fz.us.base.util.PinyinUtil;
import com.google.common.collect.Maps;
import com.joint.base.bean.EnumManage;
import com.joint.base.entity.*;
import com.joint.base.entity.system.Admin;
import com.joint.base.service.*;
import com.joint.base.util.DataUtil;
import com.joint.base.util.ImageCropUtil;
import com.mongodb.gridfs.GridFSDBFile;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.activiti.engine.HistoryService;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.TaskService;
import org.activiti.engine.history.HistoricProcessInstance;
import org.activiti.engine.repository.ProcessDefinition;
import org.activiti.engine.runtime.ProcessInstance;
import org.activiti.engine.task.Task;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.shiro.crypto.SecureRandomNumberGenerator;
import org.apache.struts2.convention.annotation.ParentPackage;
import web.action.BaseAdminAction;

import javax.annotation.Resource;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.text.SimpleDateFormat;
import java.util.*;

/**
 * Created by hpj on 2014/9/16.
 */
@ParentPackage("com")
public class AjaxUsersAction extends BaseAdminAction {

    @Resource
    private UsersService usersService;
    @Resource
    private DepartmentService departmentService;
    @Resource
    private PostService postService;
    @Resource
    private DutyService dutyService;
    @Resource
    private TaskService taskService;
    @Resource
    private RuntimeService runtimeService;
    @Resource
    private RepositoryService repositoryService;
    @Resource
    private HistoryService historyService;
    @Resource
    private FileManageService fileManageService;
    @Resource
    private PowerService powerService;
    @Resource
    private ProcessConfigService processConfigService;
    @Resource
    private PermissionService permissionService;
    @Resource
    private AdminService adminService;

    protected Pager pager;
    protected Users user;
    protected Admin admin;
    protected List<Users> usersList;
    private ArrayList<Map<String,Object>> departArrayList;
    private List<Map<String,Object>> postArrayList;
    private Map<String,Object> dutyMap;
    private Set<Post> postSet;
    private List<Duty> dutyList;
    private List<Department> departmentList;
    private ArrayList<Map<String,Object>> dutyArrayList;
    private ArrayList<Map<String,Object>> taskArrayList;
    private List<Map<String,Object>> usersmapList;
    private List<Map<String,Object>> commentList;

    private String keyId;
    private String email;
    private String mobile;
    private String name;
    private String password;
    private String no;
    private String rowId;
    private String rowIds;
    private String idCard;
    private String address;
    private String province;
    private String city;
    private String county;
    private String phone;
    private String terminal;
    private String personalSign;
    private String departmentname;
    private String postname;
    private File filedata;
    private String filename;
    private String filedataFileName;
    private String filedataContentType;
    private String imgUrl;
    private String todoTask;
    private String finishTask;
    private String businessKeyList;
    private int todoNum;
    private int finishNum;
    private int totalTask;
    private int x;
    private int y;
    private int w;
    private int h;
    private FileManage fileManage;
    private String fileId;


    /**
     *返回人员管理视图
     * @return
     */
    public String list(){
        Company company= usersService.getCompanyByUser();
        pager = new Pager();
        pager.setPageSize(rows);
        pager.setPageNumber(page);
        pager.setOrderBy("no");
        pager.setOrderType(BaseEnum.OrderType.asc);

        pager = usersService.findByPagerAndCompany(pager, null, company, new StateEnum[]{StateEnum.Enable, StateEnum.Disenable});
        usersList = (List<Users>) pager.getList();
        List<JSONObject> dataRows=new ArrayList<JSONObject>();
        Map<String, Object> data = new HashMap<String, Object>();
        Map<String,Object> rMap;
        for(Users users:usersList){
            rMap = new HashMap<String, Object>();
            rMap.put("id",users.getId());
            rMap.put("no",users.getNo());
            Duty defaultDuty= dutyService.getDefaultDuty(users);
            List<Duty> dutyList1= dutyService.getDutys(users);
            if(defaultDuty==null){
                rMap.put("defaultId","defaultId");
            }
            else{
                rMap.put("defaultId","");
            }

            if(dutyList1.size()<1){
               rMap.put("dutyId","dutyId");
            }
            else {
                rMap.put("dutyId","");
            }
            if(StateEnum.Enable.value().equals(users.getState().value())){
                rMap.put("state","state");
            }
            else{
                rMap.put("state","");
            }
            String imgUrl = "";
            List<FileManage> fileManageList = fileManageService.getFileByKeyId(users.getId());
            if(fileManageList.size() > 0){
                FileManage fileManage = fileManageList.get(0);
                imgUrl = fileManage.getUrl();
            }
            rMap.put("userImg",imgUrl);
            rMap.put("name",users.getName());
            rMap.put("email",users.getEmail()+"("+users.getMobile()+")");
            rMap.put("createDate", DataUtil.DateTimeToString(users.getCreateDate()));
            dataRows.add(JSONObject.fromObject(rMap));
        }
        long total =pager.getTotalCount();
        if(total%rows==0){
            total = total/rows;
        }else{
            if(total<rows){
                total = 1;
            }else{
                total = total/rows + 1;
            }
        }
        data.put("dataRows",dataRows);
        data.put("page",page);
        data.put("rows",rows);
        data.put("total",total);
        data.put("records",pager.getTotalCount());
        return  ajaxJson(JSONObject.fromObject(data).toString());
    }

    /**
     * 返回人员编辑视图
     * @return
     */
    public String read(){
        if(StringUtils.isNotEmpty(keyId)){
            user = usersService.get(keyId);
            dutyList=dutyService.getDutys(user);
        }
        return "read";
    }
    /**
     * 冻结、激活
     */
    public String setUserState(){
        if(StringUtils.isNotEmpty(keyId)){
            Users users=usersService.get(keyId);

            if(users.getState().equals(StateEnum.Enable)){
                users.setState(StateEnum.Disenable);
            }else {
                users.setState(StateEnum.Enable);
            }
            usersService.update(users);
        }
        return ajaxHtmlCallback("200","设置成功!","操作状态");
    }
    /**
     * 个人信息
     */
    public String profile(){
//        if(StringUtils.isNotEmpty(keyId)){
//            user = usersService.get(keyId);
//            dutyList=dutyService.getDutys(user);
//        }
//        List<HistoricTaskInstance> hisTaskList = historyService.createHistoricTaskInstanceQuery().taskAssignee(usersService.getLoginInfo().getId()).orderByTaskCreateTime().desc().list();
//        taskArrayList=new ArrayList<Map<String, Object>>();
//        Map<String,Object> rMap;
//        for(HistoricTaskInstance hisTask : hisTaskList){
//            rMap=taskInfo(hisTask);
//            taskArrayList.add(rMap);
//        }
//        Users loginer =  usersService.getLoginInfo();
//        int m = historyService.createHistoricProcessInstanceQuery().involvedUser(loginer.getId()).finished().list().size();
//        int n = runtimeService.createProcessInstanceQuery().involvedUser(loginer.getId()).list().size();
//        todoNum=n;
//        finishNum=m;
//        totalTask=m+n;
//        DecimalFormat d1=new DecimalFormat("0");
//        todoTask=d1.format(((float)n/(m+n))*100);
//        finishTask=d1.format(((float)m/(m+n))*100);


        user =  usersService.getLoginInfo();
        List<Task> taskList = taskService.createTaskQuery().taskCandidateOrAssigned(user.getId()).active().orderByTaskCreateTime().desc().list();

        taskArrayList = new ArrayList();
        Map<String,Object> rMap;
        for(Task task:taskList){
            ProcessDefinition processDefinition = workflowService.getProDefinitionByTask(task);
            ProcessInstance processInstance = workflowService.getProIntanceByTask(task);
            String key = processInstance.getBusinessKey();
            int numStatus = (int) runtimeService.getVariable(task.getExecutionId(),"numStatus");

            rMap = new HashMap<String,Object>();
            String state  = numStatus == 0 ? "草稿中" : "流转中";
            rMap.put("state",state);
            rMap.put("pname",processDefinition.getName());
            rMap.put("taskname",task.getName());
            rMap.put("creator",workflowService.getStarter(key));
            rMap.put("createDate",DataUtil.DateToString(task.getCreateTime(),"yyyy-MM-dd HH:mm"));
            rMap.put("docId",key);
            Permission permission = permissionService.getByKey(processDefinition.getKey());
            if(permission !=null){
                rMap.put("url",permission.getUrl()+"?keyId="+key);
            }else {
                rMap.put("url","");
            }
            taskArrayList.add(rMap);
        }
        return "profile";


    }



    /**
     *个人已归档视图
     * @return
     */
    public String listFinish(){

        Users users =  usersService.getLoginInfo();
        List<HistoricProcessInstance> hisProList = historyService.createHistoricProcessInstanceQuery().involvedUser(users.getId()).finished().list();

        List<JSONObject> dataRows=new ArrayList<JSONObject>();
        Map<String, Object> data = new HashMap<String, Object>();
        Map<String,Object> rMap;
        for(HistoricProcessInstance proc:hisProList){
            String key = proc.getBusinessKey();
            ProcessDefinition processDefinition = workflowService.getProDefinitionByKey(key);

            rMap = new HashMap<String,Object>();
            rMap.put("pname",processDefinition.getName());
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            rMap.put("endDate",sdf.format(proc.getEndTime()));
            rMap.put("docId",key);

            dataRows.add(JSONObject.fromObject(rMap));
        }
        long records = hisProList.size();
        long total = records;
        if(total%rows==0){
            total = total/rows;
        }else{
            if(total<rows){
                total = 1;
            }else{
                total = total/rows + 1;
            }
        }

        data.put("dataRows",dataRows);
        data.put("page",page);
        data.put("rows",rows);
        data.put("total",total);
        data.put("records",records);
        return  ajaxJson(JSONObject.fromObject(data).toString());
    }



    /**
     * 草稿和待办
     */
    public String todoAndDraft(){
        List<JSONObject> dataRows=new ArrayList<JSONObject>();
        Map<String,Object> data=new HashMap<String, Object>();
        return "";
    }
    /**
     * 批量审批
     * @return
     */
    public String batchApprove(){
        if(businessKeyList!=null ){
            for(String proId:StringUtils.split(businessKeyList,",")){
                if(StringUtils.isEmpty(proId)) continue;
                Task task= taskService.createTaskQuery().processInstanceBusinessKey(proId).taskCandidateOrAssigned(usersService.getLoginInfo().getId()).active().list().get(0);
                ProcessConfig processConfig=processConfigService.findConfigByActivityId(task.getProcessDefinitionId(), task.getTaskDefinitionKey());
                List<Duty>  dutyList=processConfigService.findDutyByConfig(processConfig);
                Map<String,Object> var= Maps.newHashMap();
                if(dutyList!=null && dutyList.size()>0){
                    Duty duty=dutyList.get(0);
                    var.put("curDutyId",duty.getUsers().getId());
                }
                task.setAssignee(usersService.getLoginInfo().getId());
                taskService.claim(task.getId(),usersService.getLoginInfo().getId());
                taskService.complete(task.getId(),var);
            }
        }
        return ajaxHtmlCallback("200","审批成功!","操作状态");
    }

    /**
     * 上传图片
     * @return
     */
    public String uploadImg() throws IOException {
        fileManage = gridFSSave(new FileInputStream(filedata), filename, "","APPLICATION/OCTET-STREAM");
        fileId=fileManage.getId();
        Map<String, Object> data = new HashMap<String, Object>();
        data.put("gridId",fileManage.getId());
        data.put("fileUrl",fileManage.getUrl());
        data.put("status","200");
        data.put("title","操作状态");
        data.put("message","上传头像成功！");

        return ajaxJson(JSONObject.fromObject(data).toString());
    }

    /**
     * 人员添加页面
     */
    public String input(){
        return  "input";
    }

    /**
     * 用户唯一性校验
     * @return
     */
    public void isUnique() {
        PrintWriter out = null;
        Users user= usersService.getUsersByEmail(email);
        try {
            out = getResponse().getWriter();
            if (user != null){
                out.print(true);
            } else{
                out.print(false);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }

    }

    /**
     * 添加人员
     * @return
     */
    public String save(){
        String salt = new SecureRandomNumberGenerator().nextBytes().toHex();
        if(StringUtils.isNotEmpty(keyId)){
            user = usersService.get(keyId);
            admin=adminService.getByMobile(user.getMobile());
        }else{
            user = new Users();
            admin=new Admin();
        }

        System.out.print("email.."+email);
        user.setEmail(email);
        user.setMobile(mobile);
        user.setName(name);
        user.setNo(no);
        user.setCompany(usersService.getCompanyByUser());
//        user.setSalt(salt);
        user.setPassword(usersService.encodedPassword(email,password,salt));
        user.setPinYin(PinyinUtil.getPingYin(name));
        user.setPinYinHead(PinyinUtil.getPinYinHeadChar(name));
        user.setState(StateEnum.Enable);
        if(StringUtils.isNotEmpty(admin.getId())){
            admin.setUsermobile(mobile);
            adminService.update(admin);
            user.setAdminId(admin.getId());
        }else{
            String id=adminService.registe(usersService.getCompanyByUser(),mobile, password, EnumManage.AccountType.Manager).getId();
            user.setAdminId(id);
        }
        if(StringUtils.isNotEmpty(keyId)){
            user.setAddress(address);
            user.setIdCard(idCard);
            user.setProvince(province);
            user.setCity(city);
            user.setCounty(county);
            user.setPhone(phone);
            user.setTerminal(terminal);
            user.setPersonalSign(personalSign);
            usersService.update(user);
        }else{
            usersService.save(user);
        }
        return ajaxHtmlCallback("200", "保存成功！","操作状态");
    }

    /**
     * 人员删除
     * @return
     */
    public String delete(){
        if(StringUtils.isEmpty(keyId)){
            return ajaxHtmlCallback("200", "请选择成员！","操作状态");
        }
        Users user = usersService.get(keyId);
        List<Task> taskList=taskService.createTaskQuery().taskAssignee(user.getId()).active().orderByTaskCreateTime().desc().list();
        List<Duty> dutyList1=dutyService.getDutys(user);
        if(dutyList1.size()>0){
            return ajaxHtmlCallback("400","请先删除职责","操作状态");
        }
        if(taskList.size()>0){
            return ajaxHtmlCallback("400","请先处理待办","操作状态");
        }
        user.setState(StateEnum.Delete);
        usersService.update(user);
        return ajaxHtmlCallback("200", "保存成功！","操作状态");
    }

    /**
     * 点击分配岗位弹出dialog中的确定按钮事件
     * @return
     */
    public String config(){
        JSONArray dataRows = JSONArray.fromObject(rowIds);
        if(StringUtils.isEmpty("keyId")){
            return ajaxHtmlCallback("200", "请选择员工！","操作状态");
        }
        Users user = usersService.get(keyId);

        for(int i=0;i<dataRows.size();i++){
            JSONObject obj = dataRows.getJSONObject(i);
            String rowId = obj.getString("id");
            String departId = rowId.split("-")[0];
            String postId = rowId.split("-")[1];
            Department department = departmentService.get(departId);
            Post post = postService.get(postId);
            Power power=powerService.getPowerByDepartAndPost(department,post);
            Duty duty= new Duty(user,power,department,post);
            dutyService.save(duty);
        }

        return ajaxHtmlCallback("200", "保存成功！", "操作状态");
    }

    /**
     * 点击分配岗位弹出dialog
     * @return
     */
    public String configView(){
        company=usersService.getCompanyByUser();
        departArrayList = new ArrayList<Map<String, Object>>();
        if(StringUtils.isEmpty("keyId")){
            return ajaxHtmlCallback("200", "请选择成员！","操作状态");
        }
        pager = new Pager(0);
        pager= departmentService.findByPagerAndCompany(pager,null,company,new StateEnum[]{StateEnum.Enable});
        List<Department> departments= (List<Department>) pager.getList();
        Map<String,Object> rmap=null;
        for(Department department:departments){
            rmap=new HashMap<String, Object>();
            rmap.put("departId", department.getId());
            rmap.put("departName",department.getName());
            rmap.put("checked", "");
            departArrayList.add(rmap);
        }
        return "configView";
    }

    /**
     * 点击分配岗位弹出dialog中的部门checkBox，查询出该部门下的岗位
     * @return
     */
    public String configPost(){
        if(StringUtils.isEmpty(rowId)){
            return ajaxHtmlCallback("400", "请选择部门！","操作状态");
        }
        Department department=departmentService.get(rowId);
        List<JSONObject> dataRows = new ArrayList<JSONObject>();
        Map<String, Object> data = new HashMap<String, Object>();
        Map<String, Object> rMap = null;
        List<Power> powerList=powerService.getByDepartId(rowId);
        Set<Post> postSet;
        Map<String,Object> rmap;
        postArrayList=new ArrayList<Map<String, Object>>();
        if(powerList!=null && powerList.size()>0){
            postSet=new HashSet<Post>();
            for(Power power:powerList){
                if(power.getPost()!=null){
                    postSet.add(power.getPost());
                }
            }
            if(postSet!=null && postSet.size()>0){
                for(Post post:postSet){
                    rmap=new HashMap<String, Object>();
                    rmap.put("id",rowId+"-"+post.getId());
                    rmap.put("name",department.getName()+"-"+post.getName());
                    rmap.put("checked","");
                    dataRows.add(JSONObject.fromObject(rmap));
                }
            }
        }
        data.put("state","200");
        data.put("rows", JSONArray.fromObject(dataRows));
        data.put("title", "操作状态");
        return ajaxJson(JSONObject.fromObject(data).toString());
    }

    /**
     * 默认职责更新
     */
    public String defaultDuty(){
        if(StringUtils.isEmpty(keyId)){
            return ajaxHtmlCallback("400", "选择人员职责信息！","操作状态");
        }
        Duty duty=dutyService.get(keyId);
        if(duty.getDutyDefault() != 1){
            duty.setDutyDefault(1);
        }else{
            duty.setDutyDefault(0);
        }
        dutyService.update(duty);
        return ajaxHtmlCallback("200", "设置成功！", "操作状态");
    }
    /**
     * 重置密码
     * @return
     */
    public String reset(){
        if(StringUtils.isEmpty(keyId)){
            return ajaxHtmlCallback("400", "请选择员工！","操作状态");
        }
        String salt = new SecureRandomNumberGenerator().nextBytes().toHex();
        Users user = usersService.get(keyId);
//        user.setSalt(salt);
        user.setPassword(usersService.encodedPassword(user.getEmail(),password,salt));
        usersService.update(user);
        return ajaxHtmlCallback("200", "重置成功！","操作状态");
    }

    /**
     * 查看职责信息
     * @return
     */
    public String leftView(){
        if(StringUtils.isEmpty(keyId)){
            return ajaxHtmlCallback("400", "请选择员工！","操作状态");
        }
        Users user  = usersService.get(keyId);
        Duty duty=dutyService.get(keyId);
        dutyList = dutyService.getDutys(user);
        dutyArrayList=new ArrayList<Map<String, Object>>();
        Map<String,Object> rMap;
        for(Duty dutys:dutyList){
            rMap=new HashMap<String, Object>();
            rMap.put("department",dutys.getPower().getDepartment());
            rMap.put("post",dutys.getPower().getPost());
            rMap.put("id",dutys.getId());
            rMap.put("checked","");
            if(dutys.getDutyDefault() == 1){
                rMap.put("checked","checked");
            }
            dutyArrayList.add(rMap);
        }
        return "leftView";
    }

    /**
     * 裁剪头像
     * @return
     */
    public String imgCropDlg(){
        List<FileManage> fileManageList = fileManageService.getFileByKeyId(keyId);
        if(fileManageList.size()>0){
            FileManage fileManage = fileManageList.get(0);
            imgUrl = fileManage.getUrl();
        }
        return "imgCropDlg";
    }
    public String cropSave() throws IOException {
        List<FileManage> fileManageList = fileManageService.getFileByKeyId(keyId);
        FileManage fileManage = fileManageList.get(0);
        GridFSDBFile gridFile = gridFSGet(fileManage.getGridId());
        String path = "/resource/images";

        File dirFile = new File(path);
        if (!dirFile.exists()) {
            dirFile.mkdirs();
        }
        String imgPath = path+ "/" + fileManage.getName();
        File imgFile = new File(imgPath);
        gridFile.writeTo(imgFile);
        String tPath = "/resource/images/crop/"+ fileManage.getName();
        String targetPath = ImageCropUtil.cutImage(imgPath, tPath, x, y, w, h);

        File cropFile = new File(targetPath);
        gridFSSave(new FileInputStream(cropFile), fileManage.getName(), keyId);

        FileUtils.deleteQuietly(cropFile);
        FileUtils.deleteQuietly(imgFile);
        return ajaxHtmlCallback("200", "裁剪成功！","操作状态");
    }

    /**
     * 删除职责信息
     * @return
     */
    public String deleteDuty(){
        // Todo 查看到底是设置默认职责还是删除职责
        if(StringUtils.isEmpty(keyId)){
            return ajaxHtmlCallback("400", "请选择员工！","操作状态");
        }
        Duty duty = dutyService.get(keyId);
        duty.setState(StateEnum.Delete);
        dutyService.update(duty);
        return ajaxHtmlCallback("200", "删除成功！","操作状态");
    }

    public Pager getPager() {
        return pager;
    }

    public void setPager(Pager pager) {
        this.pager = pager;
    }

    public List<Users> getUsersList() {
        return usersList;
    }

    public void setUsersList(List<Users> usersList) {
        this.usersList = usersList;
    }

    public Users getUser() {
        return user;
    }

    public void setUser(Users user) {
        this.user = user;
    }

    public String getKeyId() {
        return keyId;
    }

    public void setKeyId(String keyId) {
        this.keyId = keyId;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public ArrayList<Map<String, Object>> getDepartArrayList() {
        return departArrayList;
    }

    public void setDepartArrayList(ArrayList<Map<String, Object>> departArrayList) {
        this.departArrayList = departArrayList;
    }

    public String getRowId() {
        return rowId;
    }

    public void setRowId(String rowId) {
        this.rowId = rowId;
    }

    public String getRowIds() {
        return rowIds;
    }

    public void setRowIds(String rowIds) {
        this.rowIds = rowIds;
    }

    public List<Department> getDepartmentList() {
        return departmentList;
    }

    public void setDepartmentList(List<Department> departmentList) {
        this.departmentList = departmentList;
    }

    public Set<Post> getPostSet() {
        return postSet;
    }

    public void setPostSet(Set<Post> postSet) {
        this.postSet = postSet;
    }

    public String getIdCard() {
        return idCard;
    }

    public void setIdCard(String idCard) {
        this.idCard = idCard;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getProvince() {
        return province;
    }

    public void setProvince(String province) {
        this.province = province;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public String getCounty() {
        return county;
    }

    public void setCounty(String county) {
        this.county = county;
    }

    public String getNo() {
        return no;
    }

    public void setNo(String no) {
        this.no = no;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getTerminal() {
        return terminal;
    }

    public void setTerminal(String terminal) {
        this.terminal = terminal;
    }

    public String getPersonalSign() {
        return personalSign;
    }

    public void setPersonalSign(String personalSign) {
        this.personalSign = personalSign;
    }

    public String getDepartmentname() {
        return departmentname;
    }

    public void setDepartmentname(String departmentname) {
        this.departmentname = departmentname;
    }

    public String getPostname() {
        return postname;
    }

    public void setPostname(String postname) {
        this.postname = postname;
    }

    public Map<String, Object> getDutyMap() {
        return dutyMap;
    }

    public void setDutyMap(Map<String, Object> dutyMap) {
        this.dutyMap = dutyMap;
    }

    public List<Duty> getDutyList() {
        return dutyList;
    }

    public void setDutyList(List<Duty> dutyList) {
        this.dutyList = dutyList;
    }

    public File getFiledata() {
        return filedata;
    }

    public void setFiledata(File filedata) {
        this.filedata = filedata;
    }

    public String getFilename() {
        return filename;
    }

    public void setFilename(String filename) {
        this.filename = filename;
    }

    public String getFiledataFileName() {
        return filedataFileName;
    }

    public void setFiledataFileName(String filedataFileName) {
        this.filedataFileName = filedataFileName;
    }

    public String getFiledataContentType() {
        return filedataContentType;
    }

    public void setFiledataContentType(String filedataContentType) {
        this.filedataContentType = filedataContentType;
    }

    public List<Map<String, Object>> getUsersmapList() {
        return usersmapList;
    }

    public void setUsersmapList(List<Map<String, Object>> usersmapList) {
        this.usersmapList = usersmapList;
    }

    public List<Map<String, Object>> getCommentList() {
        return commentList;
    }

    public void setCommentList(List<Map<String, Object>> commentList) {
        this.commentList = commentList;
    }

    public ArrayList<Map<String, Object>> getDutyArrayList() {
        return dutyArrayList;
    }

    public void setDutyArrayList(ArrayList<Map<String, Object>> dutyArrayList) {
        this.dutyArrayList = dutyArrayList;
    }

    public ArrayList<Map<String, Object>> getTaskArrayList() {
        return taskArrayList;
    }

    public void setTaskArrayList(ArrayList<Map<String, Object>> taskArrayList) {
        this.taskArrayList = taskArrayList;
    }

    public String getImgUrl() {
        return imgUrl;
    }

    public void setImgUrl(String imgUrl) {
        this.imgUrl = imgUrl;
    }

    public int getX() {
        return x;
    }

    public void setX(int x) {
        this.x = x;
    }

    public int getY() {
        return y;
    }

    public void setY(int y) {
        this.y = y;
    }

    public int getW() {
        return w;
    }

    public void setW(int w) {
        this.w = w;
    }

    public int getH() {
        return h;
    }

    public void setH(int h) {
        this.h = h;
    }

    public String getTodoTask() {
        return todoTask;
    }

    public void setTodoTask(String todoTask) {
        this.todoTask = todoTask;
    }

    public String getFinishTask() {
        return finishTask;
    }

    public void setFinishTask(String finishTask) {
        this.finishTask = finishTask;
    }

    public int getTodoNum() {
        return todoNum;
    }

    public void setTodoNum(int todoNum) {
        this.todoNum = todoNum;
    }

    public int getFinishNum() {
        return finishNum;
    }

    public void setFinishNum(int finishNum) {
        this.finishNum = finishNum;
    }

    public int getTotalTask() {
        return totalTask;
    }

    public void setTotalTask(int totalTask) {
        this.totalTask = totalTask;
    }

    public List<Map<String, Object>> getPostArrayList() {
        return postArrayList;
    }

    public void setPostArrayList(List<Map<String, Object>> postArrayList) {
        this.postArrayList = postArrayList;
    }

    public String getBusinessKeyList() {
        return businessKeyList;
    }

    public void setBusinessKeyList(String businessKeyList) {
        this.businessKeyList = businessKeyList;
    }

    public FileManage getFileManage() {
        return fileManage;
    }

    public void setFileManage(FileManage fileManage) {
        this.fileManage = fileManage;
    }

    public String getFileId() {
        return fileId;
    }

    public void setFileId(String fileId) {
        this.fileId = fileId;
    }

    public Admin getAdmin() {
        return admin;
    }

    public void setAdmin(Admin admin) {
        this.admin = admin;
    }
}
